import http from '../config'

const apiService = {

    asynchronousStandardCall(_method, _methodUrl, _data) {
        // console.info('asynchronousStandardCall',_method, _methodUrl, _data);

        var call_object = {
            method: _method,
            url: _methodUrl,
            data: _data
        };

        return http(call_object)
            .then((response) => {
                if (response.status === 200 && response.data != undefined && response.data !== undefined &&
                  ( response.data.retcode === '200'  || response.data.retcode === 200 )   ) {
                    return Promise.resolve(response);
                }
                return Promise.reject(response);
            })
            .catch(err => {
                return Promise.reject(err);
            })
    }

}

export default apiService
